<template>
  <div class="wo-user">
    <template v-if="listData.items">
      <div class="wo-item" v-for="(value, index) in listData.items" v-if='index<=7'>
        <img v-bind:src="value.avatar||'../assets/image/avatar.png'" alt="user" />
      </div>
    </template>
    <template v-else>
      <div class="wo-item" v-for="i in 7"><img src="../assets/image/avatar.png" alt="avatar" /></div>
    </template>
    <div class="wo-item wo-count"><span>{{showCount}}</span></div>
  </div>
</template>

<script>
  export default {
    name: 'UserListSimple',
    props: {
      listData: {
        type: Object
      }
    },
    data () {
      return {}
    },
    computed: {
      showCount: function () {
        if (!this.listData.count) {
          return '??'
        }
        if (this.listData.count > 10000) {
          return parseInt(this.listData.count / 10000) + '万+'
        }
        return this.listData.count
      }
    }
  }
</script>

<style lang="scss" scoped>
  .wo-user {
    display: flex;
    justify-content: space-around;
    .wo-item {
      @include responsive-box();
      flex: 0 1 unified-unit(30px);
      box-sizing: border-box;
      border: 1px solid $border-color;
      border-radius: 50%;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
      }
      //统计
      &.wo-count {
        span {
          display: block;
          top: 50%;
          transform: translateY(-50%);
          width: 100%;
          height: unified-unit(20px);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          line-height: unified-unit(20px);
          font-size: unified-unit(10px);
          text-align: center;
        }
      }
    }
  }
</style>